package com.caishi.lkx.order.service;

import com.zzw.common.entity.BaseService;
import com.caishi.lkx.order.ienum.status.AssetsStatus;
import com.caishi.lkx.order.ienum.type.AssetsType;
import com.caishi.lkx.order.model.OrderModel;
import com.caishi.lkx.order.model.UserAssetsDataModel;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author by keray
 * date:2021/5/14 2:37 下午
 */
public interface IUserAssetsDataService extends BaseService<UserAssetsDataModel, Long> {

    /**
     * <p>
     * <h3>作者 keray</h3>
     * <h3>时间： 2019/9/5 14:32</h3>
     * 用户资产录入
     * </p>
     *
     * @param entity
     * @param orderModel
     * @param fictitious 虚拟发货，虚拟发货资产生命周期由上级决定
     * @return <p> {@link Boolean} </p>
     */
    @Transactional(rollbackFor = Exception.class)
    UserAssetsDataModel issueAssets(UserAssetsDataModel entity, OrderModel orderModel, boolean fictitious);

    /**
     * <p>
     * <h3>作者 keray</h3>
     * <h3>时间： 2019/11/15 2:59 PM</h3>
     * 用户是否拥有当前资产
     * </p>
     *
     * @param userId
     * @param userAssetsType
     * @param entityId
     * @return <p> {@link boolean} </p>
     * @throws
     */
    boolean userHaveAsset(String userId, AssetsType userAssetsType, String entityId);


    List<UserAssetsDataModel> userAsset(String userId, AssetsType userAssetsType, String entityId, AssetsStatus assetsStatus);

    /**
     * 获取用户某种类型的资产
     *
     * @param userId
     * @param userAssetsType
     * @return
     */
    List<UserAssetsDataModel> userAsset(String userId, AssetsType userAssetsType);

    List<UserAssetsDataModel> userAsset(String userId, AssetsType userAssetsType, AssetsStatus assetsStatus);

    /**
     * <p>
     * <h3>作者 keray</h3>
     * <h3>时间： 2019/10/16 17:06</h3>
     * 资产过期处理
     * </p>
     *
     * @param assetsType
     * @param assetId
     * @param userId
     * @return <p> {@link } </p>
     * @throws
     */
    boolean assetsInvalid(AssetsType assetsType, String assetId, String userId);

    /**
     * <p>
     * <h3>作者 keray</h3>
     * <h3>时间： 2019/10/16 18:02</h3>
     * 资产退回
     * </p>
     *
     * @return <p> {@link boolean} </p>
     * @throws
     */
    boolean assetsRefund(UserAssetsDataModel assetsModel);

    /**
     * 获取所属用户集合的资产
     *
     * @param ownerIds
     * @return
     */
    List<UserAssetsDataModel> ownerGroupAssets(List<String> ownerIds);
}
